var vm = new Vue({
    el:"#app",
    data() {
        return {
            month: '',
            year: '',
            hour: '',
            minutes: '',
            seconds: '',
            day: '',
            date: '',
            time: '',
            week: '',
            years: '',
            value1: '',
            show: false,
            shows: true,
            showss: false,
            place: '浦东老人状况分布',
            fuwurenshu: '',
            jinrihuifang: '',
            jinrijieting: '',
            jinridianhua: '',
            jinridingcan: '',
            laorenzongshu: '',
            curnum: '',
            curnum2: '',
            curnum3: '',
            listGDLB: [],
            showWindow: false,
            listGDXQ: {},
            listJDLR: [],
            showImgOne: true,
            showImgTwo: false,
            showImgThree: false,
            showImgFour: false,
            showImgFive: false,
            
            arrs: [],
            jinrijieting2: '',
            jinrihuifang2: '',
            daijian: '',
            yijian: '',
            weijian: '',
            showPage: true,
            imgList: ['../images/c.jpg','../images/d.jpg','../images/e.jpg','../images/f.jpg'],
            
            //data:[["洋泾街道","2"],["花木街道","3"],["沪东新村街道","2"],["陆家嘴街道","2"],["南码头路街道","2"],["浦兴路街道","2"],["潍坊新村街道","2"],["周家渡街道","2"],["上钢新村街道","2"],["东明路街道","2"],["金杨新村街道","2"],["高东镇","3"],["张江镇","1"],["高行镇","1"],["塘桥街道","3"],["申港街道","3"],["合庆镇","3"],["金桥镇","3"],["三林镇","3"],["曹路镇","3"],["唐镇","1"],["川沙新镇","1"],["惠南镇","1"],["书院镇","1"],["大团镇","1"],["北蔡镇","3"],["周浦镇","1"],["祝桥镇","1"],["新场镇","1"],["高桥镇","1"],["万祥镇","1"],["宣桥镇","1"],["老港镇","1"],["六灶镇","1"],["航头镇","1"],["南汇新城","1"],["康桥镇","1"],["泥城镇","1"]],
            //data:[["洋泾街道","2"],["花木街道","3"],["沪东新村街道","2"],["陆家嘴街道","2"],["南码头路街道","2"],["浦兴路街道","2"],["潍坊新村街道","2"],["周家渡街道","2"],["上钢新村街道","2"],["东明路街道","2"],["金杨新村街道","2"],["高东镇","3"],["张江镇","1"],["高行镇","1"],["塘桥街道","3"],["申港街道","3"],["合庆镇","3"],["金桥镇","3"],["三林镇","3"],["曹路镇","3"],["唐镇","1"],["川沙新镇","1"],["惠南镇","1"],["书院镇","1"],["大团镇","1"],["北蔡镇","3"],["周浦镇","1"],["祝桥镇","1"],["新场镇","1"],["高桥镇","1"],["万祥镇","1"],["宣桥镇","1"],["老港镇","1"],["六灶镇","1"],["航头镇","1"],["南汇新城","1"],["康桥镇","1"],["泥城镇","1"]],
            data:[],
            address:[
                     {name:"花木街道",classname:"huamu",imgsrc:("")},
                     
                     {name:"沪东新村街道",classname:"hudongxincun",imgsrc:("")},
                     
                     {name:"陆家嘴街道",classname:"lujiazui",imgsrc:("")},
                     
                     {name:"潍坊新村街道",classname:"weifangxincun",imgsrc:("")},
                     {name:"高桥镇",classname:"gaoqiao",imgsrc:("")},
                     {name:"金杨新村街道",classname:"jinyangxincun",imgsrc:("")},
                     {name:"高行镇",classname:"gaohang",imgsrc:("")},
                     {name:"高东镇",classname:"gaodong",imgsrc:("")},
                     {name:"曹路镇",classname:"caolu",imgsrc:("")},
                     {name:"浦兴路街道",classname:"puxinglu",imgsrc:("")},
                     {name:"金桥镇",classname:"jinqiao",imgsrc:("")},
                     {name:"塘桥街道",classname:"tangqiao",imgsrc:("")},
                     {name:"洋泾街道",classname:"yangjing",imgsrc:("")},
                     {name:"周家渡街道",classname:"zhoujiadu",imgsrc:("")},
                     {name:"上钢新村街道",classname:"shanggangxincun",imgsrc:("")},
                     {name:"南码头路街道",classname:"nanmatoulu",imgsrc:("")},
                     {name:"三林镇",classname:"sanlin",imgsrc:("")},
                     {name:"东明路街道",classname:"dongminglu",imgsrc:("")},
                     {name:"北蔡镇",classname:"beicai",imgsrc:("")},
                     {name:"张江镇",classname:"zhangjiang",imgsrc:("")},
                     {name:"唐镇",classname:"tangzhen",imgsrc:("")},
                     {name:"合庆镇",classname:"heqing",imgsrc:("")},
                     {name:"川沙新镇",classname:"chuanshaxincheng",imgsrc:("")},
                     {name:"康桥镇",classname:"kangqiao",imgsrc:("")},
                     {name:"周浦镇",classname:"zhoupu",imgsrc:("")},
                     {name:"航头镇",classname:"hangtou",imgsrc:("")},
                     {name:"新场镇",classname:"xinchang",imgsrc:("")},
                     {name:"宣桥镇",classname:"xuanqiao",imgsrc:("")},
                     {name:"祝桥镇",classname:"zhuqiao",imgsrc:("")},
                     {name:"老港镇",classname:"laogang",imgsrc:("")},
                     {name:"惠南镇",classname:"huinan",imgsrc:("")},
                     {name:"大团镇",classname:"datuan",imgsrc:("")},
                     {name:"书院镇",classname:"shuyuan",imgsrc:("")},
                     {name:"万祥镇",classname:"wanxiang",imgsrc:("")},
                     {name:"泥城镇",classname:"nicheng",imgsrc:("")},
                     {name:"南汇新城",classname:"nanhuixincheng",imgsrc:("")},
                 ] 
            
            
            
        }
    },
    mounted() {
    	this.jzxx2();
    	//this.jzxx2();
        // this.test();
        var date = new Date()
        var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
        var weeks= date.getDay();
        
        this.date = date
        this.month = date.getMonth() + 1
        this.year = date.getFullYear()
        this.hour = date.getHours()
        this.minutes = date.getMinutes()
        this.seconds = date.getSeconds()
        this.day = date.getDate()
        if (this.month < 10) {
            this.month = '0' + this.month
        }
        if (this.seconds < 10) {
         this.seconds = '0' + this.seconds
        }
        if (this.minutes < 10) {
         this.minutes = '0' + this.minutes
        }
        if (this.hour < 10) {
         this.hour = '0' + this.hour
        }
        if (this.day < 10) {
            this.day = '0' + this.day
        }
        this.years = this.year + '-' + this.month + '-' + this.day
        this.value = this.years
        console.log(this.years)
        this.showTime();
        this.zdgh();
        this.zdgh2();
        this.gdlb(this.years)
        this.jdlr();
        this.pudong();
        this.zdqz();
        this.jzxx();
        
        
        // this.test();
        this.reflash();
        this.reflash2();
//        this.imgHuan();
        
//        this.imgHuan2();
//        for (var i = 0; i < this.data.length; i++) {
//            for (var a = 0; a < this.address.length; a++) {
//                if (this.data[i][0] == this.address[a].name) {
//                    this.address[a].imgsrc='../img/'+this.address[a].classname+"_"+this.data[i][1]+'.png'
//                }
//            }
//        }
        console.log(this.data)
       /* for (var i = 0; i < this.data.length; i++) {
        	for (var a = 0; a < this.address.length; a++) {
        	if (this.data[i].jzname == this.address[a].name) {
        	this.address[a].imgsrc='../img/'+this.address[a].classname+this.data[i].jzstate+'.png'
        	}
        	}
        	}
        */
        
        
        
    },
   methods: {
	  
		   clickMap(name,index) {
			   console.log(this.data)
		   this.data.forEach((item) => {if (item.jzname === name) {
			   if(item.jzurl){
		   window.open(item.jzurl);
			   }
			  // window.location.href = "http://www.baidu.com"
			   
		   }})
		   },

		 
		   mapEnter(name,index) {
		   this.data.forEach((item) => {if (item.jzname === name) {
		   if (item.jzurl) {
		   this.$refs.maps[index].style.cursor = 'pointer'
		   }
		   }})
		   },

	   
      
	   test() {
		   var _this = this
		   setTimeout((res) => {
		   _this.showImgTwo = false
		   _this.showImgFour = false
		   _this.showImgThree = false
		   _this.showImgOne = false
		   _this.showImgOne = false
		   },7300)
		   setTimeout((res) => {
		   _this.showImgTwo = true
		   _this.showImgFour = false
		   _this.showImgThree = false
		   _this.showImgOne = false
		   _this.showImgOne = false
		   },8300) 
		   setTimeout((res) => {
		   _this.showImgTwo = false
		   _this.showImgFour = false
		   _this.showImgThree = false
		   _this.showImgOne = false
		   _this.showImgFive = false
		   },19000)
		   setTimeout((res) => {
		   _this.showImgTwo = false
		   _this.showImgFour = false
		   _this.showImgThree = true
		   _this.showImgOne = false
		   _this.showImgFive = false
		   },20000)
		   setTimeout((res) => {
		   _this.showImgTwo = false
		   _this.showImgFour = false
		   _this.showImgThree = false
		   _this.showImgOne = false
		   _this.showImgFive = false
		   },32000) 
		   setTimeout((res) => {
		   _this.showImgTwo = false
		   _this.showImgFour = true
		   _this.showImgThree = false
		   _this.showImgOne = false
		   _this.showImgFive = false
		   },33000)
		   setTimeout((res) => {
		   _this.showImgTwo = false
		   _this.showImgFour = false
		   _this.showImgThree = false
		   _this.showImgOne = false
		   _this.showImgFive = false
		   },41500) 
		   setTimeout((res) => {
		   _this.showImgTwo = false
		   _this.showImgFour = false
		   _this.showImgThree = false
		   _this.showImgOne = false
		   _this.showImgFive = true
		   },42500) 
		},
       showTime() {
           setTimeout(() => {
            var date = new Date()
            var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
            var weeks= date.getDay();
            
            this.date = date
            this.month = date.getMonth() + 1
            this.year = date.getFullYear()
            this.hour = date.getHours()
            this.minutes = date.getMinutes()
            this.seconds = date.getSeconds()
            this.day = date.getDate()
            if (this.month < 10) {
                this.month = '0' + this.month
            }
            if (this.seconds < 10) {
             this.seconds = '0' + this.seconds
            }
            if (this.minutes < 10) {
             this.minutes = '0' + this.minutes
            }
            if (this.hour < 10) {
             this.hour = '0' + this.hour
            }
            if (this.day < 10) {
                this.day = '0' + this.day
            }
            
               this.time = this.hour + ':' + this.minutes + ':' + this.seconds
               this.years = this.year + '/' + this.month + '/' + this.day
               this.week = weekday[weeks]
               this.showTime();
           },1000)
       },
       yijians() {
           this.show = true
           this.shows = false
       },
       back() {
           this.show = false
           this.shows = true
       },
       tableList2Click(index) {
           this.place = this.$refs.tableList2[index].innerText + '老人状况分布'
           this.showss = true
           let a = this.arrs[index]
           $.ajax({
            dataType: 'json',
            url:"/kjzl/sceen/sceenAction_loadOlderCountByAge2.action",
            data:{jdcode: a},
            success:function(datas){
                let obj = datas
                const arr =  []
                for (let i in obj) {
                    arr.push(obj[i])
                }
                var data = [
                    {value:2, name:'60-65岁老人'},
                    {value:2, name:'65-69岁老人'},
                    {value:4, name:'70-79岁老人'},
                    {value:5, name:'80-89岁老人'},
					{value:7, name:'90-99岁老人'},
					{value:1, name:'100及以上'}
                ]
                // data[2].value = arr[0]
                // data[1].value = arr[1]
                var song = datas
                const arrs = Object.keys(song)
                // arr[0].slice('4')
                const a = arrs[0].slice('4') - 1
                const b = arrs[1].slice('4') - 1
                const c = arrs[2].slice('4') - 1
                const d = arrs[3].slice('4') - 1
                const e = arrs[4].slice('4') - 1
                const f = arrs[5].slice('4') - 1
                data[a].value = arr[0]
                data[b].value = arr[1]
                data[c].value = arr[2]
                data[d].value = arr[3]
                data[e].value = arr[4]
                data[f].value = arr[5]
                var myCharts = echarts.init(document.getElementById('main'));
                var option=getChart3(data);
                myCharts.setOption(option);
            }
        });  

       },
       returnBack() {
           this.showss = false
           this.place = '浦东老人状况分布'
           this.pudong();
       },
       yueClick() {
           this.$refs.yue.style.background = '#2047AD'
           this.$refs.ri.style.background = '#0C1331'
           this.$refs.nian.style.background = '#0C1331'
           this.curnum = 1
           this.zdgh(this.curnum)
       },
       riClick() {
           this.$refs.ri.style.background = '#2047AD'
           this.$refs.yue.style.background = '#0C1331'
           this.$refs.nian.style.background = '#0C1331'
           this.curnum = 0
           this.zdgh(this.curnum)
       },
       nianClick() {
           this.$refs.ri.style.background = '#0C1331'
           this.$refs.yue.style.background = '#0C1331'
           this.$refs.nian.style.background = '#2047AD'
           this.curnum = 2
           this.zdgh(this.curnum)
       },

       //////
       yueClick2() {
        this.$refs.yue2.style.background = '#2047AD'
        this.$refs.ri2.style.background = '#0C1331'
        this.$refs.nian2.style.background = '#0C1331'
        this.curnum2 = 1
        this.zdgh2(this.curnum2)
        },
        riClick2() {
            this.$refs.ri2.style.background = '#2047AD'
            this.$refs.yue2.style.background = '#0C1331'
            this.$refs.nian2.style.background = '#0C1331'
            this.curnum2 = 0
            this.zdgh2(this.curnum2)
        },
        nianClick2() {
            this.$refs.ri2.style.background = '#0C1331'
            this.$refs.yue2.style.background = '#0C1331'
            this.$refs.nian2.style.background = '#2047AD'
            this.curnum2 = 2
            this.zdgh2(this.curnum2)
        },
        yueClick3() {
            this.$refs.yue3.style.background = '#2047AD'
            this.$refs.ri3.style.background = '#0C1331'
            this.$refs.nian3.style.background = '#0C1331'
            this.curnum3 = 1
            this.zdqz(this.curnum3)
            
            },
        riClick3() {
            this.$refs.ri3.style.background = '#2047AD'
            this.$refs.yue3.style.background = '#0C1331'
            this.$refs.nian3.style.background = '#0C1331'
            this.curnum3 = 0
            this.zdqz(this.curnum3)
            
        },
        nianClick3() {
            this.$refs.ri3.style.background = '#0C1331'
            this.$refs.yue3.style.background = '#0C1331'
            this.$refs.nian3.style.background = '#2047AD'
            this.curnum3 = 2
            this.zdqz(this.curnum3)
            
        },
       zdgh(num) {
           // 主动关怀
           if (!num && num !== 0) {
               num = 1
           }
           
            $.ajax({
                url:'/kjzl/sceen/sceenAction_zdghfwtj3.action',
                dataType: 'json',
                data:{curnum:num},
                success : function(data) {
                    var arr = []
                    var arr2 = []
                    data.data.slice(0,9).forEach(((item) => {
                        arr.push(item[0]);
                        arr2.push(item[1]);
                    }))
                    
                    var myChartss = echarts.init(document.getElementById('leftOne'),'light');
                    var option=getChart( arr,arr2 );
                    myChartss.setOption(option);
                }
            });
       },
       zdgh2(num) {
            if (!num && num !== 0) {
                num = 1
            }
            $.ajax({
                url:'/kjzl/sceen/sceenAction_zdghfwtj3.action',
                dataType: 'json',
                data:{curnum:num},
                success : function(data) {
                    var arr = []
                    var arr2 = []
                    data.data.slice(9,19).forEach(((item) => {
                        arr.push(item[0]);
                        arr2.push(item[1]);
                    }))
                    
                    var myChartsss = echarts.init(document.getElementById('leftTwo'),'light');
                    var option=getChart2( arr,arr2 );
                    myChartsss.setOption(option);
                }
            });
       },
       gdlb(time) {
        var _this = this
        $.ajax({
            dataType: 'json',
            data:{curnum:time},
            url:"/kjzl/sceen/sceenAction_gdcl.action",
            success:function(data){
                _this.listGDLB = data
            }
        });
       },
       jdlr() {
           var _this = this
        $.ajax({
            dataType: 'json',
            url:"/kjzl/sceen/sceenAction_loadJzOlder.action",
            success:function(data){
                const arrs = []
                data.data.forEach((item) => {
                    arrs.push(item.code)
                })
                _this.arrs = arrs
                _this.listJDLR = data.data
            }
        });  
       },
       pudong() {
        var _this = this
        $.ajax({
            dataType: 'json',
            url:"/kjzl/sceen/sceenAction_loadOlderCountByAge2.action",
            success:function(datas){
                let obj = datas
                const arr =  []
                for (let i in obj) {
                    arr.push(obj[i])
                }
                var data = [
                    {value:2, name:'60-65岁老人'},
                    {value:2, name:'65-69岁老人'},
                    {value:4, name:'70-79岁老人'},
                    {value:5, name:'80-89岁老人'},
					{value:7, name:'90-99岁老人'},
					{value:1, name:'100及以上'}
                ]
                var song = datas
                const arrs = Object.keys(song)
                const a = arrs[0].slice('4') -  1
                const b = arrs[1].slice('4') - 1
                const c = arrs[2].slice('4') - 1
                const d = arrs[3].slice('4') - 1
                const e = arrs[4].slice('4') - 1
                const f = arrs[5].slice('4') - 1
                data[a].value = arr[0]
                data[b].value = arr[1]
                data[c].value = arr[2]
                data[d].value = arr[3]
                data[e].value = arr[4]
                data[f].value = arr[5]
                var myCharts = echarts.init(document.getElementById('main'));
                var option=getChart3(data);
                myCharts.setOption(option);
            }
        });  
       },
       zdqz(num) {
        if (!num && num !== 0) {
            num = 1
        }
        $.ajax({
            dataType: 'json',
            url:"/kjzl/sceen/sceenAction_zdqzfwtj.action",
            data:{curnum:num},
            success:function(data){
                var myChart = echarts.init(document.getElementById('chartmain','light'));
                var option=getChart4( data.data );
                myChart.setOption(option);
            }
        });  
       },
       jzxx() {
           var _this = this
        $.ajax({
            dataType: 'json',
            url:"/kjzl/sceen/sceenAction_jzCount.action",
            success:function(data){
              data.data.forEach((item) => {
                  if (item[0] === '1') {
                      _this.yijian = item[1]
                  }
                  else if (item[0] === '2') {
                      _this.daijian = item[1]
                  }
                  else if (item[0] === '3') {
                      _this.weijian = item[1]
                  }
              })
            }
        });   
       },
      jzxx2() {
        var _this = this
        $.ajax({
            dataType: 'json',
            url:"/kjzl/sceen/sceenAction_loadJzState.action",
            success:function(data){
            	//console.log(data)
                _this.data = data.data
                for (var i = 0; i < data.data.length; i++) {
                	for (var a = 0; a < _this.address.length; a++) {
                	if (data.data[i].jzname == _this.address[a].name) {
                	_this.address[a].imgsrc='../img/'+_this.address[a].classname+data.data[i].jzstate+'.png'
                	}
                	}
                	}
            }
        
        });   
        
       },
       reflash() {
           var _this = this
        $.ajax({
             type:"json",
             url:"/kjzl/sceen/sceenAction_queryjqrlx.action",
             success:function(data){
                 var code=data.data;
                 if(code=='1'){
                     _this.showPage = false
                     
                 } else if (code=='0') {
                    //  clearTimeout()
                    _this.showPage = true
                    _this.showImgTwo = false
                    _this.showImgFour = false
                    _this.showImgThree = false
                    _this.showImgOne = true
                    _this.showImgFive = false
                 }
             }
         });
        },
        reflash2() {
            setTimeout((res) => {
                this.reflash();
                this.reflash2();
            },2000)
        },
       spanOne() {
        this.$refs.spanOne.style.background = '#2047AD'
        this.$refs.spanTwo.style.background = '#0C1331'
        this.$refs.spanThree.style.background = '#0C1331'
       },
       spanTwo() {
        this.$refs.spanOne.style.background = '#0C1331'
        this.$refs.spanTwo.style.background = '#2047AD'
        this.$refs.spanThree.style.background = '#0C1331' 
       },
       spanThree() {
        this.$refs.spanOne.style.background = '#0C1331'
        this.$refs.spanTwo.style.background = '#0C1331'
        this.$refs.spanThree.style.background = '#2047AD' 
       },
       guanbi() {
           this.showWindow = false
       },
       showWindows(index) {
           this.showWindow = true
           var _this = this
           var applyid = this.listGDLB[index].applyid
           var lrid = this.listGDLB[index].lrid
           $.ajax({
            dataType:"json",
            url:"/kjzl/sceen/sceenAction_gdxq.action",
            data:{applyid:applyid,lrid:lrid},
            type:'post',
            success:function(data){
                _this.listGDXQ = data
            }
        });
       },
   },
   watch: {
     value1() {
         var date =  new Date(this.value1)
         var year = date.getFullYear()
         var month = date.getMonth() + 1
         var day = date.getDate()
         if (month < 10) {
             month = '0' + month
         }
         if (day < 10) {
             day = '0' + day
         }
         const value = `${year}-${month}-${day}`
         
          this.value = value
          if (!this.value1) {
              this.value = this.value
          }
//         if (this.value === '1970-01-01') {
//        	 var yearss = this.years.replace(/[/]/g, "-")
//        	 this.gdlb(yearss)
//        	 }
//         else {
        	 this.gdlb(this.value)
//         }
         
     },
     showPage() {
        // var _this = this
        if (!this.showPage) {
            this.test();
       }
     }
   }
   
})

// 老人注册量
function lrzcl(){
    $.ajax({
        type:"json",
        url:"/kjzl/sceen/sceenAction_lrzcsl.action",
        success:function(data){
            
            vm.laorenzongshu=data.success
        }
    });
}

// 今日电话
function jrdh(){
    $.ajax({
        type:"json",
        url:"/kjzl/sceen/sceenAction_jrdhzs.action",
        success:function(data){
            vm.jinridianhua=data.success
        }
    });
}

// 今日订餐
function jrdc(){
    $.ajax({
        type:"json",
        url:"/kjzl/sceen/sceenAction_jrdc.action",
        success:function(data){
        vm.jinridingcan=data.success
        }
    });
}


// 今日回访
function jrhf(){
    var _this = this
    
    $.ajax({
        type:"json",
        url:"/kjzl/sceen/sceenAction_jrdhhf1.action",
        success:function(data){
            vm.jinrihuifang = data.success
            jrjt();
        }
    });
}

// 今日接听
function jrjt(){
    $.ajax({
        type:"json",
        url:"/kjzl/sceen/sceenAction_jrdt.action",
        success:function(data){
            vm.jinrijieting = data.success
           jrdh();
        }
    });
}

// 服务总数
function newqyzs(){
    $.ajax({
        type:"json",
        url:"/kjzl/sceen/sceenAction_newqyzs.action",
        success:function(data){
            vm.fuwurenshu = data.success
        }
    });
}
// 电子围栏
var sbsbids=[];
var sbsbIndex=0;
var mytimer;

$(function(){
	  $.ajax({
	    type : 'get',
	    url : '/kjzl/sceen/sceenAction_qqdzwlxx.action',
	    success : function(res) {
	      sbsbids = res.data;
	      if (sbsbids.length>0){
	      xhqqdzwlxx();
	      setInterval(function(){
	        sbsbIndex=0;
	        $("#con1").find("li").remove();
	        $("#con2").find("li").remove();
	        xhqqdzwlxx();
	      },1000*60*30);
	      }
	    },
	    error : function(err){
	    }
	  });
	});


function xhqqdzwlxx(){
	var m=sbsbIndex++;
	qqdzwlxx(sbsbids[m][0],sbsbids[m][1]);
}

//请求电子围栏信息
function qqdzwlxx(sbsbid,name){
	if (sbsbIndex < sbsbids.length) {
		setTimeout(window.xhqqdzwlxx, 500);
	}
	$.ajax({
		type : 'GET',
		url : 'http://188.188.2.38:12344/prx/res/'+sbsbid+'/sz_events',
		success : function(res) {
			var data = eval('(' + res + ')');
			if (data.length>0){
				for (var j=0;j<data.length;j++){
					var arr = data[j].cb.split(':');
					if (arr[1] == 'arrive'){
						$("#con1").append(" <li  style='font-size: 20px;height: 60px;color: green;text-align: center'><img style='margin-right:12px;margin-bottom:-5px;' src='../images/arrive.png' />"+name+"老人进入电子围栏</li>");
						$("#con2").append(" <li  style='font-size: 20px;height: 60px;  color: green;text-align: center'><img style='margin-right:12px;margin-bottom:-5px;' src='../images/arrive.png' />"+name+"老人进入电子围栏</li>");
						clearInterval(mytimer);mytimer=setInterval(window.scrollUp,100);
					} else if (arr[1] == 'leave'){
						$("#con1").append(" <li style='font-size: 20px; height: 60px; color: red;text-align: center'><img style='margin-right:12px;margin-bottom:-5px;' src='../images/leave.png' />"+name+"老人离开电子围栏</li>");
						$("#con2").append(" <li style='font-size: 20px; height: 60px; color: red;text-align: center'><img style='margin-right:12px;margin-bottom:-5px;' src='../images/leave.png' />"+name+"老人离开电子围栏</li>");
						clearInterval(mytimer);mytimer=setInterval(window.scrollUp,100);
					}
					
				}
			}
		},
		error : function(err){
			
		}
	});
}

// function scrollUp(){
// 	var area =document.getElementById('scrollBox');
// 	var con1 = document.getElementById('con1');
//     if(area.scrollTop>=con1.offsetHeight){
//         area.scrollTop=0;
//     }else{
//         area.scrollTop++
//     }
//  }
		
// $(function(){
// 	var area =document.getElementById('scrollBox');
//     var con1 = document.getElementById('con1');
//     var con2 = document.getElementById('con2');
// 	mytimer=setInterval(scrollUp,100);
//     area.onmouseover=function(){
//         clearInterval(mytimer);
//     }
//     area.onmouseout=function(){
//         mytimer=setInterval(window.scrollUp,100);
//     }
// });


////// 第二页柱形图1
function getChart (data1,data2) {
    
    option = {
        xAxis: {
            type: 'category',
            // data: ['北蔡镇', '含庆镇', '张江镇', '金杨街道', '花木街道', '上岗街道', '东明街道','浦兴街道', '周家渡街道'],
            data: data1,
            axisLabel: {
                show: true,
                textStyle: {
                color: '#07122E',  //更改坐标轴文字颜色
                fontSize : 1      //更改坐标轴文字大小
                },
                interval: 0
            },
            splitLine : {
                // show:false,
                lineStyle: {
                    color: '#483d8b',
                    type: 'dashed',
                    width: 1
                }
            },
            axisLine:{
                lineStyle:{
                    color:'#0F1B64' 
                }
            }
        },
        yAxis: {
            type : 'value',
            name : '',
            axisLabel : {
                formatter: '{value}',
                textStyle: {
                    color: '#c3dbff'
                }
            },
            axisLine:{
                lineStyle:{
                    color:'#0F1B64' 
                }
            },
            // 网格变成虚线
            splitLine:{ 
                show:true, 
                lineStyle:{ 
                    type:'dashed',
                    color: '#0F1B64' 
                } 
            } 
        },
       
	    title : {
            subtext: '单位:/人次',
        },
        tooltip : {
            trigger: 'axis'
        },
    // calculable : true,
        series: [{
            data: data2,
            // data: [1000,1060,1040,1020,1050,1200,1260,1350,1540],
            type: 'bar',
            barWidth: 25,
            barCategoryGap: 40,
            itemStyle: {
               normal: {
                   label: {
                       show: true,		//开启显示
                       position: 'top',	//在上方显示
                       textStyle: {	    //数值样式
                           color: '#fff',
                           fontSize: 12
                       }
                   },
                   color: '#1883D7'
               }
            }
        }],
        grid: {
            top: '15%',
            left: '9%',
            right: 0,
            bottom: '15%'
        }
    };
    //  var myChartss = echarts.init(document.getElementById('leftOne'));
    // // 环状图
    // //使用制定的配置项和数据显示图表
    // myChartss.setOption(option);
   
    return option;
}


////// 第二页柱形图2
function getChart2(data3,data4) {
    option = {
        xAxis: {
            type: 'category',
            // data: ['三林镇','周浦镇', '高桥镇', '惠南镇'],
            data: data3,
            axisLabel: {
                show: true,
                textStyle: {
                    color: '#07122E',  //更改坐标轴文字颜色
                    fontSize : 1      //更改坐标轴文字大小
                },
                interval: 0
            },
            splitLine : {
                // show:false,
                lineStyle: {
                    color: '#483d8b',
                    type: 'dashed',
                    width: 1
                }
            },
            axisLine:{
                lineStyle:{
                    color:'#0F1B64' 
                }
            }
        },
        yAxis: {
            type : 'value',
            name : '',
            axisLabel : {
                formatter: '{value}',
                textStyle: {
                    color: '#c3dbff'
                }
            },
            axisLine:{
                lineStyle:{
                    color:'#0F1B64' 
                }
            },
            // 网格变成虚线
            splitLine:{ 
                show:true, 
                lineStyle:{ 
                    type:'dashed',
                    color: '#0F1B64' 
                } 
            } 
        },
        title : {
            subtext: '单位:/人次',
        },
        tooltip : {
	        trigger: 'axis'
	    },
        series: [{
            // data: [1000,1060,1040],
            data: data4,
            type: 'bar',
            barWidth: 25,
            barCategoryGap: 40,
            itemStyle: {
               normal: {
                   label: {
                       show: true,		//开启显示
                       position: 'top',	//在上方显示
                       textStyle: {	    //数值样式
                           color: '#fff',
                           fontSize: 12
                       }
                   },
                   color: '#1883D7'
               }
            }
        }],
        grid: {
            top: '15%',
            left: '12%',
            right: '3%',
            bottom: '15%'
        }
    };
    //  var myChartsss = echarts.init(document.getElementById('leftTwo'));
    // // 环状图
    // //使用制定的配置项和数据显示图表
    // myChartsss.setOption(option);
    return option;
}

function getChart3(data) {
    option = {
        tooltip: {//提示框，可以在全局也可以在
            trigger: 'item',  //提示框的样式
            formatter: "{a} <br/>{b}: {c} ({d}%)",
            backgroundColor: 'rgba(255,255,255,0.7)',     // 提示背景颜色，默认为透明度为0.7的黑色
       	    borderColor: '#333',  //提示框的背景色
            textStyle:{ //提示的字体样式
                color:"black",
            }
        },
        legend: {  //图例
            orient: 'vertical',  //图例的布局，竖直    horizontal为水平
			x: 'center',//图例显示在右边
			y: '60%',
            data:['60-65岁老人','65-69岁老人','70-79岁老人','80-89岁老人','90-99岁老人','100及以上'],
            textStyle:{    //图例文字的样式
                color:'#fff',  //文字颜色
                fontSize: 12    //文字大小
            }
        },
        series: [
            {
                name:'老人比例',
                type:'pie', //环形图的type和饼图相同
                radius: ['50%', '80%'],//饼图的半径，第一个为内半径，第二个为外半径
				center: ['47%','40%'],
                avoidLabelOverlap: false,
                color:['#D1FBEF','#F9D858','#4CD0DD','#DF86F0','#F5A7C1','#CE764E'],
                label: {
                    normal: {  //正常的样式
                        show: false,
                        position: 'left'
                    }
                },  
                // data:[
                //     {value:2, name:'60-65岁老人'},
                //     {value:2, name:'65-69岁老人'},
                //     {value:4, name:'70-79岁老人'},
                //     {value:5, name:'80-89岁老人'},
				// 	{value:7, name:'90-99岁老人'},
				// 	{value:1, name:'100及以上'}
                // ]
                data:data
            }
        ]
    };
    // var myCharts = echarts.init(document.getElementById('main'));
    // // 环状图
    // //使用制定的配置项和数据显示图表
    // myCharts.setOption(option);
    return option;
}




function getChart4(data) {
    option = {
        xAxis: {
            type: 'category',
            data: ['服务咨询', '代拨电话', '叫醒服务', '叫车服务', '法律援助', '医疗咨询', '政策咨询','紧急求助'],
            axisLabel: {
                show: true,
                textStyle: {
                color: '#c3dbff',  //更改坐标轴文字颜色
                fontSize : 10       //更改坐标轴文字大小
                },
                interval: 0
            },
            // 更改坐标轴颜色
            axisLine:{
                lineStyle:{
                    color:'#0F1B64' 
                }
            }
        },
        yAxis: {
            type : 'value',
            name : '',
            axisLabel : {
                formatter: '{value}',
                textStyle: {
                    color: '#c3dbff'
                }
            },
            axisLine:{
                lineStyle:{
                    color:'#0F1B64' 
                }
            },
            // 网格变成虚线
            splitLine:{ 
                show:true, 
                lineStyle:{ 
                    type:'dashed',
                    color: '#0F1B64' 
                } 
            } 
        },
        series: [{
            // data: [120, 200, 150, 80, 70, 110, 130, 30],
            data: data,
            type: 'bar',
            barWidth: 20,
            barCategoryGap: 40,
            itemStyle: {
               normal: {
                   label: {
                       show: true,		//开启显示
                       position: 'top',	//在上方显示
                       textStyle: {	    //数值样式
                           color: '#fff',
                           fontSize: 10
                       }
                   },
                   color: '#C19F05'
               },
               
            }
        }],
        grid: {
            top: '30%',
            left: '10%',
            // right: '1%',
            bottom: '15%'
        }
    };
    
    
    // //初始化echarts实例
    // var myChart = echarts.init(document.getElementById('chartmain','light'));
    // // 环状图
    // //使用制定的配置项和数据显示图表
    // myChart.setOption(option);
    return option;
}

//jrdh();
lrzcl();
jrdc();
jrhf();
//jrjt();
newqyzs();



function zhixing() {
    
    setTimeout(() => {
       // jrdh();
        lrzcl();
        jrdc();
        jrhf();
        //jrjt();
        newqyzs();
        zhixing();
        vm.zdgh(1);
        vm.$refs.yue.style.background = '#2047AD'
        vm.$refs.ri.style.background = '#0C1331'
        vm.$refs.nian.style.background = '#0C1331'
        vm.zdgh2(1);
        vm.$refs.yue2.style.background = '#2047AD'
        vm.$refs.ri2.style.background = '#0C1331'
        vm.$refs.nian2.style.background = '#0C1331'
        vm.gdlb(vm.years.replace(/[/]/g,'-'));
        vm.jdlr();
        vm.pudong();
        
        vm.zdqz(1);
        vm.$refs.yue3.style.background = '#2047AD'
        vm.$refs.ri3.style.background = '#0C1331'
        vm.$refs.nian3.style.background = '#0C1331'
        // xhqqdzwlxx();
        vm.jzxx();
        vm.jzxx2();
    },60000)
}
zhixing();
